package com.sz.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import java.util.Properties;

@Configuration
public class FreeMarkerConfig {

    @Bean
    public FreeMarkerConfigurer freeMarkerConfigurer() {
        FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
        // Set template loader paths to include generator templates
        String[] templateLoaderPaths = {
            "classpath:/templates/",
            "classpath:/templates/api/",
            "classpath:/templates/sql/",
            "classpath:/templates/vue/",
            "classpath:/mapper/",
            "classpath:/"
        };
        configurer.setTemplateLoaderPaths(templateLoaderPaths);
        Properties settings = new Properties();
        settings.setProperty("default_encoding", "UTF-8");
        configurer.setFreemarkerSettings(settings);
        return configurer;
    }
}